package com.zgc.util;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@Component

public class DaliyTask {
    private static final DateTimeFormatter dateTimeFormatter =
            DateTimeFormatter.ofPattern("HH:mm:ss");
    //每5秒执行一次（5000） 1000*60*60*24（一天）
    @Scheduled(fixedRate = 5000)
    public void reportCurrentTime() {
//实现邮件发送
        System.out.println("现在时间是：" +
                dateTimeFormatter.format(LocalDateTime.now()));
    }
}
